import request from '@/config/axios'

// 活动主题 VO
export interface ActivityTopicVO {
  id: number // 主键ID
  name: string // 活动名称
  status: number // 活动状态
  remark: string // 活动备注
  startTime: Date // 活动开始时间
  endTime: Date // 活动结束时间
  sort: number // 排序字段
}

// 活动主题 API
export const ActivityTopicApi = {
  // 查询活动主题分页
  getActivityTopicPage: async (params: any) => {
    return await request.get({ url: `/promotion/activity-topic/page`, params })
  },

  // 查询活动主题详情
  getActivityTopicById: async (id: number) => {
    return await request.get({ url: `/promotion/activity-topic/getById?id=` + id })
  },

  // 新增活动主题
  createActivityTopic: async (data: ActivityTopicVO) => {
    return await request.post({ url: `/promotion/activity-topic/create`, data })
  },

  // 修改活动主题
  updateActivityTopic: async (data: ActivityTopicVO) => {
    return await request.post({ url: `/promotion/activity-topic/update`, data })
  },

  // 修改活动主题状态
  updateActivityTopicStatus: async (id: number, status: number) => {
    const data = {
      id,
      status
    }
    return await request.post({ url: `/promotion/activity-topic/updateStatus`, data: data })
  },

  // 删除活动主题
  deleteActivityTopicById: async (id: number) => {
    return await request.get({ url: `/promotion/activity-topic/delete?id=` + id })
  },

  // 导出活动主题 Excel
  exportActivityTopic: async (params) => {
    return await request.download({ url: `/promotion/activity-topic/export-excel`, params })
  },
}
